class Solution {
    struct cmp
    {
        bool operator()(int a, int b)
        {
            string str1 = to_string(a);
            string str2 = to_string(b);
            return str1 + str2 >  str2 + str1;
        }
    };
public:
    string largestNumber(vector<int>& nums) {
        sort(nums.begin(), nums.end(), cmp());
        string ret;
        for(auto& e : nums)
        {
            ret += to_string(e);
        }
        return ret[0] == '0' ? "0" : ret; // 去掉前导0
    }
};